const Router = require('koa-router');
const router = new Router();
const authController = require('../controllers/authController');
const novelController = require('../controllers/novelController');
const commentController = require('../controllers/commentController');
const uploadController = require('../controllers/uploadController');
const authMiddleware = require('../middleware/auth');

router.post('/register', authController.register);
router.post('/login', authController.login);
router.post('/upload', uploadController.uploadFile, uploadController.handleUpload);

router.get('/novels', novelController.getNovels);
router.get('/novels/:id', novelController.getNovelById);

// Comment routes

router.post('/novels/:id/comments', authMiddleware, commentController.createComment);

router.get('/comments', commentController.getComments);

module.exports = router;